<template>
  <div class="login-container">
    <!-- 背景装饰 -->
    <div class="background-decoration">
      <div class="decoration-circle circle-1"></div>
      <div class="decoration-circle circle-2"></div>
      <div class="decoration-circle circle-3"></div>
    </div>

    <!-- 顶部区域 -->
    <div class="top-section">
      <div class="logo-section">
        <div class="logo-icon">
          <i class="fa fa-cutlery"></i>
        </div>
        <h1 class="app-title">饿了么</h1>
        <p class="app-subtitle">美食即刻送达</p>
      </div>
    </div>

    <!-- 登录表单区域 -->
    <div class="form-section">
      <div class="form-header">
        <h2 class="form-title">用户登录</h2>
        <p class="form-subtitle">请输入您的账号信息</p>
      </div>

      <div class="form-content">
        <div class="input-group">
          <div class="input-wrapper">
            <div class="input-icon">
              <i class="fa fa-mobile"></i>
            </div>
            <input 
              v-model="form.phone" 
              type="text" 
              placeholder="请输入手机号码"
              class="form-input"
            >
          </div>
        </div>

        <div class="input-group">
          <div class="input-wrapper">
            <div class="input-icon">
              <i class="fa fa-lock"></i>
            </div>
            <input 
              v-model="form.password" 
              type="password" 
              placeholder="请输入密码"
              class="form-input"
            >
          </div>
        </div>

        <div class="forgot-password">
          <a href="#" class="forgot-link">忘记密码？</a>
        </div>

        <div class="button-group">
          <button @click="handleLogin" class="login-button">
            <span>登录</span>
          </button>
          
          <button @click="goToRegister" class="register-button">
            <span>还没有账号？立即注册</span>
          </button>
        </div>

        <div class="divider">
          <span class="divider-text">或</span>
        </div>

        <div class="quick-login">
          <div class="quick-login-item">
            <i class="fa fa-weixin"></i>
            <span>微信登录</span>
          </div>
          <div class="quick-login-item">
            <i class="fa fa-qq"></i>
            <span>QQ登录</span>
          </div>
        </div>
      </div>
    </div>

    <Footer />
  </div>
</template>

<script lang="ts">
import { defineComponent, reactive } from 'vue'
import { useRouter } from 'vue-router'
import Footer from '../components/Footer.vue'

export default defineComponent({
  name: 'Login',
  components: {
    Footer
  },
  setup() {
    const router = useRouter()

    const form = reactive({
      phone: '',
      password: ''
    })

    const handleLogin = () => {
      // 简单的表单验证
      if (!form.phone) {
        alert('请输入手机号码')
        return
      }
      
      if (!form.password) {
        alert('请输入密码')
        return
      }

      console.log('登录信息:', form)
      // 添加登录逻辑
      router.push('/index')
    }

    const goToRegister = () => {
      router.push('/register')
    }

    return {
      form,
      handleLogin,
      goToRegister
    }
  }
})
</script>

<style scoped>
/* 总容器 */
.login-container {
  width: 100%;
  min-height: 100vh;
  background: linear-gradient(135deg, #74b9ff 0%, #0984e3 100%);
  position: relative;
  overflow: hidden;
  padding-bottom: 16vw;
}

/* 背景装饰 */
.background-decoration {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  z-index: 1;
}

.decoration-circle {
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
}

.circle-1 {
  width: 60vw;
  height: 60vw;
  top: -20vw;
  right: -20vw;
}

.circle-2 {
  width: 40vw;
  height: 40vw;
  top: 20vw;
  left: -15vw;
}

.circle-3 {
  width: 25vw;
  height: 25vw;
  bottom: 30vw;
  right: -10vw;
}

/* 顶部区域 */
.top-section {
  position: relative;
  z-index: 2;
  padding: 12vw 8vw 8vw 8vw;
  text-align: center;
}

.logo-section {
  margin-bottom: 8vw;
}

.logo-icon {
  width: 16vw;
  height: 16vw;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 0 auto 4vw auto;
  backdrop-filter: blur(10px);
  border: 2px solid rgba(255, 255, 255, 0.3);
}

.logo-icon i {
  font-size: 8vw;
  color: white;
}

.app-title {
  font-size: 8vw;
  color: white;
  font-weight: 700;
  margin: 0 0 2vw 0;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.app-subtitle {
  font-size: 3.5vw;
  color: rgba(255, 255, 255, 0.8);
  margin: 0;
  font-weight: 300;
}

/* 表单区域 */
.form-section {
  position: relative;
  z-index: 2;
  background: white;
  margin: 0 4vw;
  border-radius: 6vw 6vw 0 0;
  padding: 6vw;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.1);
  min-height: calc(100vh - 40vw);
}

.form-header {
  text-align: center;
  margin-bottom: 8vw;
}

.form-title {
  font-size: 6vw;
  color: #333;
  font-weight: 600;
  margin: 0 0 2vw 0;
}

.form-subtitle {
  font-size: 3.2vw;
  color: #666;
  margin: 0;
}

/* 表单内容 */
.form-content {
  width: 100%;
}

.input-group {
  margin-bottom: 5vw;
}

.input-wrapper {
  position: relative;
  background: #f8f9fa;
  border-radius: 4vw;
  border: 2px solid transparent;
  transition: all 0.3s ease;
  overflow: hidden;
}

.input-wrapper:focus-within {
  border-color: #0097FF;
  background: white;
  box-shadow: 0 4px 12px rgba(0, 151, 255, 0.15);
}

.input-icon {
  position: absolute;
  left: 4vw;
  top: 50%;
  transform: translateY(-50%);
  color: #999;
  font-size: 4vw;
  z-index: 1;
}

.form-input {
  width: 100%;
  padding: 4vw 4vw 4vw 12vw;
  border: none;
  outline: none;
  background: transparent;
  font-size: 3.8vw;
  color: #333;
}

.form-input::placeholder {
  color: #999;
  font-weight: 300;
}

/* 忘记密码 */
.forgot-password {
  text-align: right;
  margin-bottom: 6vw;
}

.forgot-link {
  font-size: 3vw;
  color: #0097FF;
  text-decoration: none;
}

/* 按钮组 */
.button-group {
  margin-bottom: 6vw;
}

.login-button {
  width: 100%;
  background: linear-gradient(135deg, #0097FF 0%, #00B4FF 100%);
  color: white;
  border: none;
  border-radius: 4vw;
  padding: 4vw;
  font-size: 4.2vw;
  font-weight: 600;
  cursor: pointer;
  margin-bottom: 3vw;
  box-shadow: 0 4px 15px rgba(0, 151, 255, 0.3);
  transition: all 0.3s ease;
}

.login-button:active {
  transform: translateY(1px);
  box-shadow: 0 2px 8px rgba(0, 151, 255, 0.3);
}

.register-button {
  width: 100%;
  background: transparent;
  color: #666;
  border: 2px solid #e0e0e0;
  border-radius: 4vw;
  padding: 4vw;
  font-size: 3.8vw;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
}

.register-button:hover {
  border-color: #0097FF;
  color: #0097FF;
}

/* 分割线 */
.divider {
  position: relative;
  text-align: center;
  margin: 6vw 0;
}

.divider::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 1px;
  background: #e0e0e0;
}

.divider-text {
  background: white;
  padding: 0 4vw;
  color: #999;
  font-size: 3vw;
  position: relative;
  z-index: 1;
}

/* 快速登录 */
.quick-login {
  display: flex;
  justify-content: space-around;
  gap: 4vw;
}

.quick-login-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 4vw 2vw;
  border-radius: 3vw;
  background: #f8f9fa;
  cursor: pointer;
  transition: all 0.3s ease;
}

.quick-login-item:first-child {
  color: #2db55d;
}

.quick-login-item:last-child {
  color: #12b7f5;
}

.quick-login-item:hover {
  background: #f0f0f0;
  transform: translateY(-1px);
}

.quick-login-item i {
  font-size: 6vw;
  margin-bottom: 2vw;
}

.quick-login-item span {
  font-size: 2.8vw;
  font-weight: 500;
}

/* 响应式调整 */
@media (max-width: 375px) {
  .app-title {
    font-size: 7vw;
  }
  
  .form-title {
    font-size: 5.5vw;
  }
  
  .form-input {
    font-size: 3.5vw;
  }
}
</style>

